//
//  DBIndex.m
//  MantuPlay
//
//  Created by Markus Sintonen on 15.8.2009.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import "DBIndex.h"


@implementation DBIndex

@synthesize index;

- (id)init {
	if ((self = [super init])) {
		index = 0;
	}
	return self;
}
- (id)initWithIndex:(unsigned int)i {
	if ((self = [super init])) {
		index = i;
	}
	return self;
}
- (id)initWithDBIndex:(DBIndex*)i {
	if ((self = [super init])) {
		index = [i index];
	}
	return self;
}

+(DBIndex*)indexWithIndex:(unsigned int)i {
	return [[[self alloc] initWithIndex:i] autorelease];
}

- (BOOL)isEqual:(id)object {
	if ([object isKindOfClass:[DBIndex self]]) {
        DBIndex *otherObject = object;
        return (index == [otherObject index]) && [super isEqual:object];
    } else {
        return NO;
    }
}
- (unsigned int)hash {
    return [super hash] + index;
}
@end
